﻿using Basic.FormRemoteModel.PageLayout;
using Basic.FormRemoteModel.PageLayout.Model;
using Basic.FormService.Interface;
using WeDonekRpc.Client.Interface;

namespace Basic.FormService.RpcEvent
{
    internal class PageLayoutEvent : IRpcApiService
    {
        private readonly IPageLayoutService _Service;

        public PageLayoutEvent ( IPageLayoutService service )
        {
            this._Service = service;
        }
        public PageLayoutForm[] GetPageLayoutForm ( GetPageLayoutForm obj )
        {
            return this._Service.GetForm(obj.PageId);
        }

        public PageLayoutBase AddPageLayout ( AddPageLayout obj )
        {
            return this._Service.Add(obj.Datum);
        }
        public void MovePageLayout ( MovePageLayout obj )
        {
            this._Service.Move(obj.Id, obj.ParentId);
        }
        public void DeletePageLayout ( DeletePageLayout obj )
        {
            this._Service.Delete(obj.Id);
        }

        public PageLayoutData GetPageLayoutInfo ( GetPageLayoutInfo obj )
        {
            return this._Service.Get(obj.Id);
        }

        public void SetPageLayoutSort ( SetPageLayoutSort obj )
        {
            this._Service.SaveSort(obj.Sort);
        }

        public bool SetPageLayout ( SetPageLayout set )
        {
            return this._Service.Set(set.Id, set.Datum);
        }
    }
}
